package br.com.contabilidade.controller;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.catalina.connector.Request;
import org.apache.log4j.Logger;

/**
 * Servlet implementation class LogoutServlet
 */
@WebServlet("/view/LogoutServlet")
public class LogoutServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	static Logger logger = Logger.getLogger(LogoutServlet.class);
	
	 @Override
		protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		 	String nome = request.getParameter("nome");
			request.getSession().setAttribute("usuarioLogado", null);
			RequestDispatcher rq = request.getRequestDispatcher("login.jsp");
			logger.info("Usuario "+nome+" realizou LogOut!");
			rq.forward(request, response);
		}   	

}
